<?php

include '../global.php';
include LIB_PATH.'biz/search/SearchInfomation.php';
include LIB_PATH.'utils/showContent.php';
include LIB_PATH.'db/db.php';

session_start();

$type = null;
switch ($_GET['type']) {
    case '奖励':
        $type = 'Awards';
        break;
    case '论著':
        $type = 'Treaties';
        break;
    case '期刊论文':
        $type = 'JournalThesis';
        break;
    case '会议论文':
        $type = 'ConferenceThesis';
        break;
    case '专利':
        $type = 'Patent';
        break;
    case '软件著作权':
        $type = 'SoftwareCopyright';
        break;
    case '项目':
        $type = 'Project';
        break;
    default:
        $type = '';
        break;
}

/* 建立查询sql语句 */
$queryStr = sprintf('select * from %s ', $type  );

if($_GET['name']!=""){
    $queryStr .= 'where name=\''.$_GET['name'].'\'';
}

/* 执行查询 */
$query = mysql_query($queryStr, $GLOBALS['DB']);
/* 显示结果 */
$searchInfomation = new SearchInfomation($type, $query);
showHeader();
echo '<body align="center">';
$searchInfomation->show(__FILE__, '../../public_files/update/updatePage.php');

/* 传递导出内容的方式需要改进，不能用get方法传递query语句 */
$excelHref = "../../public_files/excel/excelPage.php?type=".$type;
$excelHref .="&query=".$queryStr;
echo '<a href="'.$excelHref.'" >导出Excel</a>';
echo "</body>";